<#import "../tpl/pageTep.ftl" as page>
    <@page.pageBase currentMenu="订单支付">

    <!--suppress ALL -->
    <form id="searchForm" class="form-panel">
        <ul class="panel-content">
            <li>
                <div class="form-actions">
                    <a href="javascript:add()" class="button button-success">
                        <i class="icon-plus-sign icon-white"></i> 添加
                    </a>
                    <a  class="button button-danger" onclick="return delFunction();">
                        <i class="icon-remove-sign icon-white"></i> 删除
                    </a>
                </div>
            </li>
        </ul>
    </form>
    <div id="grid"></div>
<script>
var Grid = BUI.Grid,
        Store = BUI.Data.Store,
        columns = [
            {title : '支付id',dataIndex :'id', width:100},
            {title : '订单id',dataIndex :'orderId', width:100},
            {title : '',dataIndex :'transactionId', width:100},
            {title : '微信预支付编号',dataIndex :'prepayId', width:100},
            {title : '支付状态(0 待支付,1 已支付,2 已完成)',dataIndex :'payStatus', width:100},
            {title : '支付类型',dataIndex :'payType', width:100},
            {title : '支付金额',dataIndex :'payAmount', width:100},
            {title : '商品详情',dataIndex :'productBody', width:100},
            {title : '商品标题',dataIndex :'productTitle', width:100},
            {title : '创建时间',dataIndex :'createTime', width:100},
            {title : '支付时间',dataIndex :'payTime', width:100},
            {title : '备注',dataIndex :'remark', width:100},
            {title : '操作',dataIndex : 'id',width:200,renderer : function (value,obj,index) {
                    return '<a href="javascript:edit(' +value+ ')">编辑</a>';
                }
            }
        ];

var store = new Store({
            url : 'loadData',
            autoLoad:true, //自动加载数据
            params : { //配置初始请求的参数
                length : '10',
                status:$("#status").val()
            },
            pageSize:10,	// 配置分页数目
            root : 'list',
            totalProperty : 'total'
        }),
        grid = new Grid.Grid({
            render:'#grid',
            columns : columns,
            loadMask: true, //加载数据时显示屏蔽层
            store: store,
            plugins : [Grid.Plugins.CheckSelection], // 插件形式引入多选表格
            // 底部工具栏
            bbar:{
                pagingBar:true
            }
        });

grid.render();


//删除选中的记录
function delFunction(){
    var selections = grid.getSelection();
    var ids=new Array();
    for(var i=0;i<selections.length;i++){
        ids[i]=selections[i].id.toString()
    }
    $.ajax({
        type: "POST",
        url: "${basepath}/manage/orderpay/deletesJson",
        dataType: "json",
        data: {
            ids:ids
        },
        success: function (data) {
            var obj = new Object();
            obj.start = 0; //返回第一页
            store.load(obj);
        }
    });

}
</script>

</@page.pageBase>
